package org.pearl.validation.demo.config;

import org.pearl.validation.demo.other.PersonValidator;
import org.springframework.context.annotation.Configuration;
import org.springframework.validation.Validator;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;
import javax.sql.DataSource;

/**
 * Created by TD on 2021/5/21
 */
@Configuration
@EnableWebMvc
public class WebConfig implements WebMvcConfigurer {

    @Resource
    private DataSource dataSource;

    /**
     * 添加全局校验器
     */
    @Override
    public Validator getValidator() {
        return new PersonValidator();
    }

}